#include "main_right_widget.h"

main_right_widget::main_right_widget(QWidget *parent) :
    QWidget(parent)
{
    m_clock = 0;
    m_study_widget = new study_widget(this);
    m_study_widget->setObjectName("m_study_widget");
    this->setObjectName("main_right_widget");

    m_daily_widget = new daily_widget(this);
    m_daily_widget->setObjectName("m_daily_widget");
    m_daily_widget->hide();

    m_friend_widget = new friends_widget(this);
    m_friend_widget->setObjectName("m_friend_widget");
    m_friend_widget->hide();
}

void main_right_widget::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void main_right_widget::showMyClock()
{
    if (!m_clock) {
        m_clock = new simple_clock(this);
        m_clock->showMaximized();
    }else{
        m_clock->hide();
        delete m_clock;
        m_clock=0;
    }
    //m_clock->setModal(true);
}

void main_right_widget::showStudyWidget()
{
    m_study_widget->showMaximized();
    m_daily_widget->hide();
    m_friend_widget->hide();
    qDebug()<<"m_study_widget->showMaximized();";
}

void main_right_widget::showDailyWidget()
{
    m_daily_widget->showMaximized();
    m_study_widget->hide();
    m_friend_widget->hide();
    qDebug()<<"m_daily_widget->showMaximized();";
}

void main_right_widget::showFriendWidget()
{
    m_friend_widget->showMaximized();
    m_daily_widget->hide();
    m_study_widget->hide();
    qDebug()<<"m_friend_widget->showMaximized();";
}

